package org.java.db;

import java.util.List;

/**
 * 测试一些sql语句
 * Created by Administrator on 2017/1/16.
 */
public class SqlTest {

    public static void main(String[] args) throws Exception {
        // 检查表是否存在
        checkTable();
    }

    /**
     * 检查表是否存在
     * */
    public static void checkTable() throws Exception {
        List<Object[]> object = JDBCUtils.executeQuery(JDBCUtils.getConnection("/resource/jdbc.properties"),
                "SELECT COUNT(*) FROM SYSCAT.TABLES WHERE TABSCHEMA=UPPER('MMP') AND TYPE='T' AND TABNAME=UPPER('TB_MOD_MODEL_CFG') WITH UR");
        // size = 1就表示存在了
        System.out.println(object.size());
    }
}
